import sys
sys.path.append("../")
import time

from controller.servers.ServerMonitorController import *

def align_to_next_hour():
    # 获取当前时间
    now = time.localtime()
    # 计算当前分钟后还需要等待的秒数
    seconds_until_next_hour = 60 - now.tm_sec
    # 等待直到下一个整点
    time.sleep(seconds_until_next_hour)

while 1:
    align_to_next_hour()
    con = ServerMonitorController({"func":"execMonitor","server_id":1,"server_ip":"192.168.28.174"})
    con.run()
